package com.yixun.qfbao.model.enums;

import org.apache.commons.lang.StringUtils;

public enum PeopleCountEnum {
	UNLIMITED("UNLIMITED", "不限"),
	ONE("ONE", "1人"),
	TWO("TWO", "2人"),
	THREE("THREE", "3人"),
	FOUR("FOUR", "4人"),
	FIVE("FIVE","5人"),
	SIX("SIX", "6人"),
	SIX_MORE("SIX_MORE", "6人以上"),
	;

	private String no;
	private String des;

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	PeopleCountEnum(String no, String des) {
		this.no = no;
		this.des = des;
	}

	public static PeopleCountEnum getByNo(String no) {
		if (StringUtils.isBlank(no)) {
			return null;
		}
		for (PeopleCountEnum menum : values()) {
			if (menum.getNo().equals(no)) {
				return menum;
			}
		}
		return null;
	}

	public static String getNameByCode(String code) {
		if (!StringUtils.isEmpty(code)) {
			PeopleCountEnum anEnum = getByNo(code);
			if (anEnum != null) {
				return anEnum.getDes();
			} else {
				return null;
			}
		}
		return null;
	}

}
